#include <stdio.h>
int main()
{
    int n, i, j, t, x, m;

    while (scanf("%d", &n) && n) {

        int a[31][31] = { 0 };
        a[1][(n + 1) / 2] = 1; t = 2; x = 1;

        for (i = n, j = (n + 1) / 2 + 1; t <= n * n; i--, j++, t++) {

            if (a[i][j] != 0) {
                i = i + 2; j--;
            }
            if (j > n && i >= 1) {
                j = 1;
            }
            if (i < 1 && j <= n) {
                i = n;
            }
            if (i<1 && j>n) {
                i = i + 2; j--;
            }

            a[i][j] = t;
        }

        m = n * n;
        while (m != 0) {
            m = m / 10;
            x = x * 10;
        }
        x = x / 10;

        for (i = n; i >= 1; i--) {
            for (j = 1; j <= n; j++) {
                if (x == 1) printf("%d", a[i][j]);
                if (x == 10) printf("%2d", a[i][j]);
                if (x == 100) printf("%3d", a[i][j]);
                if (j != n) printf(" ");
            }
            printf("\n");
        }
        printf("\n");
    }
    return 0;
}